<template>
  <div>
    <el-dialog
      title="新增   编辑调拨单szw"
      :visible.sync="dialogTableVisible"
      :close-on-click-modal="false"
      width="900px">
      <el-form :model="queryParams" ref="queryForm" :inline="true">
        <el-form-item label="设备编号" >
          <el-input
            v-model="queryParams.deviceCode"
            placeholder="请输入设备编号"
            clearable
            size="small"
          />
        </el-form-item>
        <el-form-item label="设备名称" >
          <el-input
            v-model="queryParams.deviceName"
            placeholder="请输入设备名称"
            clearable
            size="small"
          />
        </el-form-item>

        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
          <el-button type="primary"  size="mini" @click="determine">确 定</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="loading" :data="chanpinList" stripe
                @selection-change="chanpinonChange" >
        <el-table-column align="center" type="selection" width="55"></el-table-column>
        <el-table-column align="center" type="index" label="序号"  width="55"  />
        <el-table-column align="center" label="设备编号"width="150" property="deviceCode" ></el-table-column>
        <el-table-column align="center" label="设备名称"   property="deviceName" :show-overflow-tooltip="true"  ></el-table-column>
        <el-table-column align="center" label="设备品牌" property="deviceBrandsName" :show-overflow-tooltip="true"  ></el-table-column>
        <el-table-column align="center" label="规格型号"  property="deviceModel" ></el-table-column>
<!--        <el-table-column align="center" label="所属部门"  property="deptName"  ></el-table-column>-->
        <el-table-column align="center" label="存储地点"  property="repositoryName"  ></el-table-column>
      </el-table>
      <pagination
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />

    </el-dialog>
  </div>
</template>

<script>
  import request from '@/utils/request'
  export default {
    props: ['transmitData'],
    name: "Role",
    data() {
      return {
        total:0,
        loading:false,
        dialogTableVisible:true,
        //产品查询数据
        queryParams:{
          pageNum: 1,
          pageSize: 10,
          deviceCode:'',
          deviceName:'',
        },
        newxuanz:[],//当前选中的
        //产品列表数据
        chanpinList:[],

      };
    },
    components:{

    },
    watch: {
      dialogTableVisible: function () {
        this.dialogTableVisible = true;//始终让他为true;
        this.cancel();//隐藏
      },
    },
    created() {
      console.log('接受',this.transmitData)
      this.getList()
    },
    methods: {
      /** 查询用户列表 */
      getList() {
        this.loading = true;
        request({
          url: '/device/takeStock/listDevice',
          method: 'get',
          params:this.queryParams
        }).then(response => {
          this.loading = false;
          this.chanpinList = response.rows
          this.total = response.total
        });
      },
      //确定
      determine:function(){
        this.$emit('callback',this.newxuanz)//将submitModel的值传给父组件
      },
      //隐藏
      cancel:function(){
        this.determine()

      },
      //产品表格监听
      chanpinonChange(val) {
        console.log(val)
        this.newxuanz =val

      },
      //分页
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      },

    }
  };
</script>
<style >





</style>
